package ${package}.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 * Authority Entity.
 */
@Entity
@Table(name = "authority")
public class Authority implements Serializable {
    /**
     * Default no-arg constructor.
     */
    public Authority() {
    }

    public Authority(String authority) {
        this.authority = authority;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "authority_sequence")
    @TableGenerator(name = "authority_sequence", table = "${systemArtifactId}_sequence")
    private Integer id;

    public Integer getId() {
        return id;
    }

    @Column(nullable = false, unique = true)
    private String authority;

    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Authority)) return false;

        Authority authority1 = (Authority) o;

        return authority.equals(authority1.authority);

    }

    @Override
    public int hashCode() {
        return authority.hashCode();
    }
}
